package com.ydd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ydd.entity.YddTag;
import com.ydd.mapper.SysLabelMapper;
import com.ydd.result.Result;
import com.ydd.service.SysLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class SysLabelServiceImpl extends ServiceImpl<SysLabelMapper,YddTag> implements SysLabelService{
    @Autowired
    private SysLabelMapper sysLabelMapper;

    @Override
    public Result getLabel() {
        QueryWrapper<YddTag> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("1","1");
        List<YddTag> yddTagList = sysLabelMapper.selectList(queryWrapper);
        HashMap<String, String> map = new HashMap<>();
        for (YddTag yddTag : yddTagList) {
            String id = String.valueOf(yddTag.getId());
            String tagname = yddTag.getTagname();
            map.put(id,tagname);
        }

        return Result.success(map);
    }
}
